import React, { useReducer } from 'react'
import context from './contextCreator'
import { store, reducer } from './store'

import User from './User'
import Books from './Books'

export default function Parent() {
  const [ state, dispatch ] = useReducer(reducer, store)

  const api = {
    state,
    dispatch
  }

  return (
    <context.Provider value={api}>
      <User></User>
      <Books></Books>
    </context.Provider>
  )
}
